<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        // 普通的函数
        function f1() {
            var num = 10;
            num++;
            return num;
        }
        console.log(f1()); //11
        console.log(f1()); //11
        console.log(f1()); //11
        function f1() {
            var num = 10;
            return function () {
                return num++;
            }
        }
        function f1() {
            var num = 10;
            return function () {
                num++;
                return num;
            }
        }
        var ff = f1();
        console.log(ff());
        console.log(ff());
        console.log(ff());
    </script>
</body>
</html>